//https://leetcode.cn/problems/move-zeroes/

void swap(int& x, int& y)
{
    int temp = x;
    x = y;
    y = temp;
}

class Solution {
public:
    void moveZeroes(vector<int>& nums) {

        for (int cur = 0, dest = -1; cur < nums.size(); cur++)
        {
            if (nums[cur] != 0)
            {
                swap(nums[cur], nums[++dest]);
            }
        }

    }
};